<?php include('view/template/common/header.tpl'); ?>
<?php if ($error_warning) { ?>
<div class="warning"><?php echo $error_warning; ?></div>
<?php } ?>
<?php if ($_SESSION['success']) { ?>
<div class="success"><?php echo $_SESSION['success']; ?></div>
<?php } unset($_SESSION['success']); ?>
<div class="box">
  <div class="left"></div>
  <div class="right"></div>
  <div class="heading">
    <h1 style="background-image: url('./view/image/order.png');"><?php echo $heading_title; ?></h1>
    <div class="buttons"><a onclick="location = '<?php echo $link_add; ?>'" class="button"><span><?php echo $button_add; ?></span></a><a onclick="$('#form').attr('action', '<?php echo $delete; ?>'); $('#form').attr('target', '_self'); $('#form').submit();" class="button"><span><?php echo $button_delete; ?></span></a></div>
  </div>
  <div class="content">
    <form action="" method="post" enctype="multipart/form-data" id="form">
      <table class="list">
        <thead>
          <tr>
            <td width="1" style="text-align: center;"><input type="checkbox" onclick="$('input[name*=\'selected\']').attr('checked', this.checked);" /></td>
            <td class="left">
             
              <a href="<?php echo $sort_order; ?>"> <?php echo ten; ?></a>
              </td>
             <td class="left">
              <a href="<?php echo $sort_name; ?>"><?php echo link; ?></a></td>
         
            <td class="left">
              <a href="<?php echo $sort_date_added; ?>"><?php echo view; ?></a>
            </td>
           
             <td class="left">
              <a href="<?php echo $sort_total; ?>"><?php echo loai; ?></a>
             </td>
             <td class="left">
              <a href="<?php echo $sort_total; ?>"><?php echo can_bo; ?></a>
             </td>
             <td class="left">
              <a href="<?php echo $sort_total; ?>"><?php echo cap_nhat; ?></a>
             </td>
            <td class="right"><?php echo thao_tac; ?></td>
          </tr>
        </thead>
        <tbody>
         
          <?php if ($list_quangcao) { ?>
          <?php foreach ($list_quangcao as $quangcao) { ?>
          <tr>
            <td style="text-align: center;"><?php if ($order['selected']) { ?>
              <input type="checkbox" name="selected[]" value="<?php echo $quangcao['id']; ?>" checked="checked" />
              <?php } else { ?>
              <input type="checkbox" name="selected[]" value="<?php echo $quangcao['id']; ?>" />
              <?php } ?></td>
            <td class="left"><?php echo $quangcao['ten']; ?></td>
            <td class="left"><?php echo $quangcao['link']; ?></td>
            <td class="left"><?php echo $quangcao['view']; ?></td>
            
           <td class="left"><?php echo $quangcao['ten_loai']; ?></td>
            <td class="left"><?php echo $quangcao['ten_can_bo']; ?></td>

           <td class="left">
<?php $ti = tinhthoigian(vntime_now(),$quangcao['edit']);?>
  <?php  echo $ti['so'];?> 
   <?php if($ti['chu']=='phut') {?> phút trước <?php } ?>
   <?php if($ti['chu']=='gio') {?> giờ trước <?php } ?>
   <?php if($ti['chu']=='ngay') {?> ngày trước <?php } ?>
   <?php if($ti['chu']=='0') {?> <?php } ?>
            </td>
            <td class="right" width="50">[ <a href="index.php?module=quangcao&act=<?php echo "edit";?>&id=<?php echo $quangcao['id']; ?>"><?php echo "Sửa"; ?></a> ]</td>
          </tr>
          <?php } ?>
          <?php } else { ?>
          <tr>
            <td class="center" colspan="7"><?php echo $text_no_results; ?></td>
          </tr>
          <?php } ?>
        </tbody>
      </table>
    </form>
    <div class="pagination"><?php echo $pagination; ?></div>
  </div>
</div>
<?php include('view/template/common/footer.tpl'); ?>